# $Id$
# Maintainer: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Thomas Mudrunka <harvie@email.cz>
# Contributor: m4xm4n <max@maxfierke.com>

pkgname=dnssec-anchors
pkgver=20170711
pkgrel=1
pkgdesc='DNSSEC trust anchors for the root zone'
url='https://data.iana.org/root-anchors/'
license=('custom:NoCopyright')
arch=('any')
makedepends=('unbound')

prepare() {
	cd "${srcdir}"

	unbound-anchor -v -a root.key ||
	unbound-anchor -v -a root.key

	unbound-host -v -f root.key -t DNSKEY . |
	sed 's/ (secure)//;t;d' |
	sed 's/ has / IN /' |
	sed 's/ record / /' \
	> trusted-key.key

	echo 'The contents of this package are inelligible for copyright protection.' > LICENSE
}

package() {
	cd "${srcdir}"
	install -Dm644 trusted-key.key "${pkgdir}"/etc/trusted-key.key
	install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
